home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
misc
/
emu
/
ATUtilities.lha
/
ATUtilities
/
M2
/
GEM.MOD
< prev
next >
Wrap
Text File
|
2000-09-26
|
3KB
|
121 lines
(*$S- *)
IMPLEMENTATION MODULE GEM;
FROM SYSTEM IMPORT ADR,ASSEMBLER,BYTE,WORD,ADDRESS,SEGMENT,OFFSET,SEG,OFS;
FROM Storage IMPORT ALLOCATE,DEALLOCATE;
FROM System IMPORT AX,BX,CX,DX,ES,DS,SI,DI,Trap,XTrap;
FROM Mouse IMPORT MouseOn,MouseOff;
FROM DOS IMPORT CloseTemporaryFile;
FROM VGA IMPORT SetRGB;
PROCEDURE RestoreColors();
VAR seg,ofs : CARDINAL;
BEGIN
seg := SEGMENT(gdos^.oldColors);
ofs := OFFSET(gdos^.oldColors);
ASM
MOV AX,01012H
MOV BX,0
MOV CX,16
MOV DX,seg
MOV ES,DX
MOV DX,ofs
INT 10H
END (* ASM *);
END RestoreColors;
PROCEDURE BackupColors();
VAR seg,ofs : CARDINAL;
BEGIN
seg := SEGMENT(gdos^.oldColors);
ofs := OFFSET(gdos^.oldColors);
ASM
MOV AX,01017H
MOV BX,0
MOV CX,16
MOV DX,seg
MOV ES,DX
MOV DX,ofs
INT 10H
END (* ASM *);
END BackupColors;
PROCEDURE RemoveGDOSVector();
VAR i : CARDINAL;
BEGIN
AX := 3;
Trap(010H);
IF (gdos^.graphics64 # NIL) THEN
MouseOff;
RestoreColors;
FOR i := 0 TO 99 DO
IF (gdos^.tempFile[i] # NIL) THEN
CloseTemporaryFile(gdos^.tempFile[i]);
END (* IF *);
END (* FOR *);
DEALLOCATE(gdos^.graphics64,0FFFFH);
END (* IF *);
AX := 025F1H;
DS := 0;
DX := 0;
XTrap(021H);
AX := 0;
Trap(033H);
DEALLOCATE(gdos,SIZE(GDOS));
gdos := NIL;
END RemoveGDOSVector;
PROCEDURE InstallGDOSVector() : BOOLEAN;
VAR i : CARDINAL;
BEGIN
ALLOCATE(gdos,SIZE(GDOS));
IF (gdos=NIL) THEN RETURN(FALSE); END;
BackupColors;
AX := 012H;
Trap(010H);
SetRGB(0,180,180,180);
SetRGB(1,0,0,0);
gdos^.mouseLock := 0;
ALLOCATE(gdos^.graphics64,0FFFFH);
IF (gdos^.graphics64 = NIL) THEN
RemoveGDOSVector();
RETURN(FALSE);
END (* IF *);
gdos^.gdosID[0] := "G";
gdos^.gdosID[1] := "D";
gdos^.gdosID[2] := "O";
gdos^.gdosID[3] := "S";
gdos^.gdosVersion := version;
gdos^.gdosRevision := revision;
gdos^.systemMessage := ADR(gdos^.message);
gdos^.firstWindow := NIL;
AX := 025F1H;
DS := gdos.SEG;
DX := gdos.OFS;
XTrap(021H);
FOR i := 0 TO 99 DO
gdos^.tempFile[i] := NIL;
END (* FOR *);
MouseOn();
RETURN(TRUE);
END InstallGDOSVector;
PROCEDURE GetGDOSVector() : GDOSPtr;
BEGIN
AX := 035F1H;
XTrap(021H);
gdos.SEG := ES;
gdos.OFS := BX;
IF NOT (gdos^.gdosID[0]="G") THEN RETURN(NIL); END;
IF NOT (gdos^.gdosID[1]="D") THEN RETURN(NIL); END;
IF NOT (gdos^.gdosID[2]="O") THEN RETURN(NIL); END;
IF NOT (gdos^.gdosID[3]="S") THEN RETURN(NIL); END;
RETURN(gdos);
END GetGDOSVector;
BEGIN
gdos := NIL;
END GEM.